package com.leo.train.business.mapper;

import com.github.pagehelper.Page;
import com.leo.train.business.dto.DailySeatQueryDto;
import com.leo.train.business.dto.SeatSellDto;
import com.leo.train.business.entity.DailySeat;
import org.apache.ibatis.annotations.Mapper;

import java.util.Date;
import java.util.List;

@Mapper
public interface DailySeatMapper {
    /**
     * 新增座次
     * @param dailySeat
     */
    void insert(DailySeat dailySeat);

    /**
     * 修改座次
     * @param dailySeat
     */
    void update(DailySeat dailySeat);

    /**
     * 删除座次
     * @param id
     */
    void deleteById(Long id);

    /**
     * 查询座次列表
     * @param dailySeatQueryDto
     * @return
     */
    Page<DailySeat> list(DailySeatQueryDto dailySeatQueryDto);

    /**
     * 查询座次详情
     * @param id
     * @return
     */
    DailySeat selectById(Long id);

    /**
     * 根据车次编号删除所有的座次
     * @param trainCode
     */
    void deleteByTrainCode(String trainCode);

    /**
     * 根据车次编号和日期删除所有的座次
     * @param date
     * @param trainCode
     */
    void deleteByTrainCodeByDate(Date date, String trainCode);

    /**
     * 根据车次编号和日期查询座次数量
     * @param date
     * @param trainCode
     * @param seatType
     * @return
     */
    int count(Date date, String trainCode, String seatType);

    /**
     * 根据车厢索引查询座次
     * @param date
     * @param trainCode
     * @param carriageIndex
     * @return
     */
    List<DailySeat> listByCarriage(Date date, String trainCode, Integer carriageIndex);

    /**
     * 查询座次售卖情况
     * @param seatSellDto
     * @return
     */
    List<DailySeat> querySeatSell(SeatSellDto seatSellDto);
}
